/* ----------------------------------------------------------------------------------------------------------------
 * Status
 * ----------------------------------------------------------------------------------------------------------------
 */
package pure.engine.status 
{
	import flash.geom.Point;
	import pure.engine.system.ITickObject;
	import pure.engine.system.ProcessManager;
	import pure.engine.entity.Entity;
	import pure.utils.DesN;
	import pure.engine.system.ns_despair;

	use namespace ns_despair;
	/**
	 * @inheritDoc
	 * 
	 * 状态
	 * 
	 * @author ＃Pure
	 */
public class Status implements IStatus, ITickObject
{
	
	
	protected var _entity:Entity;
	protected var _ticked:Boolean, _framed:Boolean;
	
	
	public static var cachedPoint:Point = new Point();
	
	
	public function get entity():Entity{return _entity;}
	public function set entity(E:Entity):void
	{
		if(_entity)
		{
			throw new Error('Status -＃set entity - 状态只能赋值一次.');
		}
		_entity = E;
	}
	
	public function setTicked(flag:Boolean, priority:Number = 0.0):void
	{
		if (_ticked != flag)
		{
			_ticked = flag;
			if(_ticked)
				ProcessManager.instance.addTickObject(this, priority);
			else
				ProcessManager.instance.removeTickObject(this);
		}
	}

	
	/**
	 * @inheritDoc
	 */
	public function absorb():void
	{
	}

	

	public function onTick(elapsedT:Number):void
	{
	}
		
	
	public function exit():void
	{
		setTicked(false);
		_entity = null;
		
		// 继承下面方法
		_exit();
	}
	
	
	
	protected function _exit():void
	{
	}
}

}